//
//  CPSCAll2CategoryLeftCell.m
//  CollTest
//
//  Created by codew on 11/9/21.
//

#import "CPSCAll2CategoryLeftCell.h"
#import "CPSCAll2CategoryLeftCellUIModel.h"
@interface CPSCAll2CategoryLeftCell ()
@property (weak, nonatomic) IBOutlet UIView *viewCSSuper;

@property (weak, nonatomic) IBOutlet UIView *viewSTop;
@property (weak, nonatomic) IBOutlet UIView *viewSBottom;
@property (weak, nonatomic) IBOutlet UIView *viewContent;

@property (weak, nonatomic) IBOutlet UILabel *lblName;
@property (weak, nonatomic) IBOutlet UIImageView *imageViewIcon;

@end

@implementation CPSCAll2CategoryLeftCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.contentView.backgroundColor = [UIColor whiteColor];
    self.backgroundColor = [UIColor whiteColor];
    
    /*
     kCALayerMinXMinYCorner  // 左上角
     kCALayerMaxXMinYCorner  // 右上角
     
     kCALayerMinXMaxYCorner  // 左下角
     kCALayerMaxXMaxYCorner  // 右下角
     */
    self.viewCSSuper.backgroundColor = CPSCRGBA(245, 245, 245, 1);
    self.viewSTop.backgroundColor = CPSCRGBA(245, 245, 245, 1);
    self.viewSBottom.backgroundColor = CPSCRGBA(245, 245, 245, 1);
    
    
    self.viewSTop.layer.cornerRadius = 18;
    self.viewSTop.layer.maskedCorners = kCALayerMaxXMaxYCorner;
    self.viewSTop.layer.masksToBounds = YES;
    
    
    self.viewContent.layer.cornerRadius = 8;
    self.viewContent.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMinXMaxYCorner;
    self.viewContent.layer.masksToBounds = YES;
    
    
    self.viewSBottom.layer.cornerRadius = 18;
    self.viewSBottom.layer.maskedCorners = kCALayerMaxXMinYCorner;
    self.viewSBottom.layer.masksToBounds = YES;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (void)updateCellWithCellUIModel:(CPSCAll2CategoryLeftCellUIModel *)model
{
    self.viewSTop.hidden = YES;
    self.viewSBottom.hidden = YES;
    self.viewContent.backgroundColor = [UIColor clearColor];
    self.viewCSSuper.backgroundColor = CPSCRGBA(245, 245, 245, 1);
    
    self.lblName.font = [UIFont systemFontOfSize:13];
    self.lblName.textColor = [UIColor colorWithHexString:@"#555555"];
    self.imageViewIcon.hidden = YES;
    
    if (model.type == CPSCAll2CategoryLeftCellUIModelType_Select) {
                
        self.viewContent.backgroundColor = [UIColor whiteColor];
        self.lblName.font = [UIFont boldSystemFontOfSize:15];
        self.lblName.textColor = [UIColor colorWithHexString:@"#222222"];
        self.imageViewIcon.hidden = NO;
        
    }else if (model.type == CPSCAll2CategoryLeftCellUIModelType_Top) {
                        
        self.viewCSSuper.backgroundColor = [UIColor whiteColor];
        self.viewSTop.hidden = NO;
        
    }else if (model.type == CPSCAll2CategoryLeftCellUIModelType_Bottom) {
        
        self.viewCSSuper.backgroundColor = [UIColor whiteColor];
        self.viewSBottom.hidden = NO;
        
    }else{
    }
    
    
}

/** 跟新数据源 */
- (void)updateCellWithDataItem:(id <CPSCAll2CategoryLeftViewUIModelProtocol>)item
{
    self.lblName.text = item.stringTitleTopCategory;
}


@end
